package com.sugon.controller.module;

import com.sugon.entity.ModuleTimesRecordProdEntity;
import com.sugon.service.ModuleTimesRecordProdService;
import com.sugon.utils.PageUtils;
import com.sugon.utils.Query;
import com.sugon.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * 模次每日同步记录Controller
 *
 * @author YuXD
 * @date 2020-12-21 21:56
 */
@Controller
@RequestMapping("moduletimesrecord")
public class ModuleTimesRecordController {

    @Autowired
    private ModuleTimesRecordProdService moduleTimesRecordProdService;

    /**
     * 查看列表
     */
    @RequestMapping("/list")
    @ResponseBody
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);

        List<ModuleTimesRecordProdEntity> moduleTimesRecordList = moduleTimesRecordProdService.queryList(query);
        int total = moduleTimesRecordProdService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(moduleTimesRecordList, total, query.getLimit(), query.getPage());

        return R.ok().put("page", pageUtil);
    }

}
